package cate.game.role.farm.cross_boss;

import cate.common.table.d.GDHoardTask;
import cate.common.table.d.GDOperation;
import cate.game.play.proce.play.PlayPO;
import cate.game.play.vo.PlayReportVO;
import cate.game.res.MixRes;
import cate.game.res.MixResAdder;
import cate.game.role.Role;
import cate.game.role.farm.AbstractFarmFTC;
import cate.game.role.farm.cross_boss.msg.CrossBossFightResultResp;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass("跨服BOSS战斗FTC")
public class CrossBossFarmFTC extends AbstractFarmFTC<MyCrossBossPO> {
    @NoteField("BOSS配置ID")
    public int id;
    @NoteField("挑战奖励")
    public MixRes reward;

    public CrossBossFarmFTC(Role role, int id) {
        setup(role);
        this.id = id;
    }

    @Override
    protected MyCrossBossPO po(Role role) {
        return role.getFarm().crossBoss;
    }

    @Override
    public void handleResult(Role role, PlayPO playPO) {
        super.handleResult(role, playPO);
        new MixResAdder().setRes(reward)
                .setDialogReward(false)
                .setSendMailWhenFull(true)
                .setOperation(GDOperation.CROSS_BOSS_FARM_FIGHT)
                .exe(role);
        role.sendNow(new CrossBossFightResultResp(id, reward, new PlayReportVO(playPO)));
        // 打完同步下当前BOSS信息
        role.getFarm().crossBoss.sendOverallInfo(role.getGame().farm.crossBoss.getCrossBossOverall());
        role.getFarm().crossBoss.viewBossDetail(id);
        role.getRes().hoard.addition.addTask(GDHoardTask.CROSS_BOSS);
    }
}
